<?php
namespace app\admin\controller;
use think\Controller;
use think\Session;
use think\Db;
use app\common\controller\Base;
class Common extends Base
{
    public function __construct(){
        parent::__construct();
        $session = session::get('user');
        if(!$session){
            $this->redirect('/admin/Login/login',302);
        }else{
            if($session['id']){
                $user = Db::table('user') -> where('id',$session['id']) -> find();
                if(!$user){
                    $this->redirect('/admin/Login/login',302);
                }else{
                    $this->assign('user',$session);
                }
            }else{
                $this->redirect('/admin/Login/login',302);
            }
        }
    }
}
